﻿using System.Text;

namespace jinmaMesProxy.Excep
{
    public static class ExceptionUtil
    {
        public static string FormatExceptionInfo(Exception ex)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendLine(ex.Message);
            sb.AppendLine("StackTrace:");
            sb.AppendLine(ex.StackTrace);
            if (ex.InnerException != null)
            {
                sb.AppendLine("InnerException:");
                sb.AppendLine(FormatExceptionInfo(ex.InnerException));
            }
            return sb.ToString();
        }
    }
}
